/**
 * 
 */
package com.p2p.front.jms.consumer.loan;

import javax.annotation.Resource;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.p2p.front.task.LoanTimeOpenTask;

/**
 * @author ruiqi
 *
 */
public class TenderAutoScanListener implements MessageListener{

	private final Logger logger = LoggerFactory.getLogger(TenderAutoScanListener.class);
	
	@Resource
	private LoanTimeOpenTask loanTimeOpenTask;
	
	@Override
	public void onMessage(Message message) {
		Long loanId = null;
		//System.out.println("您有一笔还款到帐，金额=");
		ObjectMessage objMsg = (ObjectMessage) message;
		try {
			Object o = objMsg.getObject();
			loanId = (Long) o;
		} catch (JMSException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		logger.info("loaninfo update message id="+ loanId);
		loanTimeOpenTask.findTimeOpenLoanSchedule();
	}
}
